<template>
<div>
  <div>
    <Select v-model="type" style="width:200px;margin-right: 20px">
      <Option :value="'1'" >社区绩效</Option>
      <Option :value="'2'">社区人员绩效</Option>
    </Select>
    <Button type="primary" @click="select">搜索</Button>
    <template>
      <Table style="margin-top: 20px" :columns="columns" :data="data"></Table>
    </template>
  </div>
</div>
</template>

<script>
import { getEvaList } from '@/api/eventlist'

export default {
  name: 'index',
  data () {
    return {
      type: '1',
      columns: [],
      columns1: [
        {
          title: '社区名',
          key: 'sq_name'
        },
        {
          title: '社区编码',
          key: 'company_code'
        },
        {
          title: '受理量',
          key: 'num'
        },
        {
          title: '办结量',
          key: 'finish_num'
        },
        {
          title: '办结率%',
          key: 'percent'
        },
        {
          title: '转件量',
          key: 'zhuan_num'
        },
        {
          title: '转件办结量',
          key: 'finish_zhuan_num'
        },
        {
          title: '转件办结率%',
          key: 'zhuan_percent'
        }
      ],
      columns2: [
        {
          title: '社区名',
          key: 'sq_name_all'
        },
        {
          title: '姓名',
          key: 'sq_name'
        },
        {
          title: '受理量',
          key: 'num'
        },
        {
          title: '办结量',
          key: 'finish_num'
        },
        {
          title: '办结率%',
          key: 'percent'
        },
        {
          title: '转件量',
          key: 'zhuan_num'
        },
        {
          title: '转件办结量',
          key: 'finish_zhuan_num'
        },
        {
          title: '转件办结率%',
          key: 'zhuan_percent'
        }
      ],
      data: []
    }
  },
  methods: {
    init () {
      let data = {
        type: this.type
      }
      if (data.type === '1') {
        this.columns = this.columns1
      } else if (data.type === '2') {
        this.columns = this.columns2
      }
      getEvaList(data).then(ret => {
        if (ret.data.errcode === 0) {
          this.data = ret.data.data
        } else {
          this.$Notice.error({
            title: '查询列表失败',
            desc: ret.data.errmsg
          })
        }
      })
    },
    select () {
      this.init()
    }
  },
  mounted () {
    this.init()
  }
}
</script>

<style scoped>

</style>
